package com.atguigu.tingshu.order.service.impl;

import com.alibaba.fastjson.JSON;
import com.atguigu.tingshu.account.client.UserAccountFeignClient;
import com.atguigu.tingshu.album.client.AlbumInfoFeignClient;
import com.atguigu.tingshu.album.client.TrackInfoFeignClient;
import com.atguigu.tingshu.common.constant.SystemConstant;
import com.atguigu.tingshu.common.rabbit.constant.MqConst;
import com.atguigu.tingshu.common.rabbit.service.RabbitService;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.album.AlbumInfo;
import com.atguigu.tingshu.model.album.TrackInfo;
import com.atguigu.tingshu.model.order.OrderDerate;
import com.atguigu.tingshu.model.order.OrderDetail;
import com.atguigu.tingshu.model.order.OrderInfo;
import com.atguigu.tingshu.model.user.VipServiceConfig;
import com.atguigu.tingshu.order.helper.SignHelper;
import com.atguigu.tingshu.order.mapper.OrderDerateMapper;
import com.atguigu.tingshu.order.mapper.OrderDetailMapper;
import com.atguigu.tingshu.order.mapper.OrderInfoMapper;
import com.atguigu.tingshu.order.service.OrderInfoService;
import com.atguigu.tingshu.user.client.UserInfoFeignClient;
import com.atguigu.tingshu.user.client.VipServiceConfigFeignClient;
import com.atguigu.tingshu.vo.account.AccountDeductVo;
import com.atguigu.tingshu.vo.order.OrderDerateVo;
import com.atguigu.tingshu.vo.order.OrderDetailVo;
import com.atguigu.tingshu.vo.order.OrderInfoVo;
import com.atguigu.tingshu.vo.order.TradeVo;
import com.atguigu.tingshu.vo.user.UserInfoVo;
import com.atguigu.tingshu.vo.user.UserPaidRecordVo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.seata.spring.annotation.GlobalTransactional;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;

import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

@Slf4j
@Service
@SuppressWarnings({"all"})
public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo> implements OrderInfoService {

    @Autowired
    private OrderInfoMapper orderInfoMapper;

    @Autowired
    private AlbumInfoFeignClient albumInfoFeignClient;

    @Autowired
    private UserInfoFeignClient userInfoFeignClient;

    @Autowired
    private VipServiceConfigFeignClient vipServiceConfigFeignClient;

    @Autowired
    private RedisTemplate redisTemplate;

    @Autowired
    private TrackInfoFeignClient trackInfoFeignClient;

    @Autowired
    private RabbitService rabbitService;

    @Autowired
    private UserAccountFeignClient userAccountFeignClient;

    @Autowired
    private OrderDetailMapper orderDetailMapper;

    @Autowired
    private OrderDerateMapper orderDerateMapper;


    @Override
    public void orderCancel(String orderNo) {
        //  主要就是修改订单状态; 二维码有效期10分; 取消订单5分; 关闭微信的支付交易记录为close; 关闭paymentInfo; orderInfo;
        OrderInfo orderInfo = getOrderInfoByOrderNo(orderNo);
        //  判断
        if (null != orderInfo && SystemConstant.ORDER_STATUS_UNPAID.equals(orderInfo.getOrderStatus())){
            //  赋值订单状态为已取消
            orderInfo.setOrderStatus(SystemConstant.ORDER_STATUS_CANCEL);
            //  更新数据
            orderInfoMapper.updateById(orderInfo);
        }
    }

    @Override
    public void orderPaySuccess(String orderNo) {
        //  修改状态为PAID;
        OrderInfo orderInfo = this.getOrderInfoByOrderNo(orderNo);
        if (null == orderInfo || SystemConstant.ORDER_STATUS_PAID.equals(orderInfo.getOrderStatus())){
            return;
        }
        orderInfo.setOrderStatus(SystemConstant.ORDER_STATUS_PAID);
        this.updateById(orderInfo);
        //  记录用户购买记录;
        UserPaidRecordVo userPaidRecordVo = new UserPaidRecordVo();
        userPaidRecordVo.setUserId(orderInfo.getUserId());
        userPaidRecordVo.setItemType(orderInfo.getItemType());
        //  ItemId = 专辑Id; 声音Id; vipId 存储在订单明细中的itemId;
        userPaidRecordVo.setItemIdList(orderInfo.getOrderDetailList().stream().map(OrderDetail::getItemId).collect(Collectors.toList()));
        userPaidRecordVo.setOrderNo(orderNo);
        userInfoFeignClient.savePaidRecord(userPaidRecordVo);
    }

    @Override
    public IPage<OrderInfo> findUserPage(Page<OrderInfo> orderInfoPage, String orderStatus, Long userId) {
        //  调用mapper 层方法
        IPage<OrderInfo> iPage = orderInfoMapper.selectUserPage(orderInfoPage, orderStatus, userId);
        iPage.getRecords().stream().forEach(orderInfo -> {
            //  赋值支付名
            orderInfo.setPayWayName(SystemConstant.ORDER_PAY_ACCOUNT.equals(orderInfo.getPayWay())?"余额支付":"在线支付");
            //  赋值支付状态名
            orderInfo.setOrderStatusName(SystemConstant.ORDER_STATUS_UNPAID.equals(orderInfo.getOrderStatus())?"未支付":SystemConstant.ORDER_STATUS_PAID.equals(orderInfo.getOrderStatus())?"已支付":"已取消");
        });
        //  返回数据；
        return iPage;
    }

    @Override
    public OrderInfo getOrderInfo(String orderNo) {
        //  根据orderNo 查看orderInfo;
        OrderInfo orderInfo = this.getOrderInfoByOrderNo(orderNo);
        //  赋值一个支付方式名称;
        orderInfo.setPayWayName(SystemConstant.ORDER_PAY_ACCOUNT.equals(orderInfo.getPayWay())?"余额支付":"在线支付");
        //  返回数据;
        return orderInfo;
    }

    /**
     * 根据订单号获取订单信息;
     * @param orderNo
     * @return
     */
    public OrderInfo getOrderInfoByOrderNo(String orderNo) {
        //  查询订单主表
        OrderInfo orderInfo = orderInfoMapper.selectOne(new LambdaQueryWrapper<OrderInfo>().eq(OrderInfo::getOrderNo, orderNo));
        //  查询订单明细表
        orderInfo.setOrderDetailList(orderDetailMapper.selectList(new LambdaQueryWrapper<OrderDetail>().eq(OrderDetail::getOrderId, orderInfo.getId())));
        //  返回订单明细；
        return orderInfo;
    }

    @Override
    //    @Transactional(rollbackFor = Exception.class)
    @GlobalTransactional(rollbackFor = Exception.class)
    public String submitOrder(OrderInfoVo orderInfoVo, Long userId) {
        //  1.  校验签名; SignHelper.getSign(orderInfoVo--->map);
        //  orderInfoVo --> Map;
        Map map = JSON.parseObject(JSON.toJSONString(orderInfoVo), Map.class);
        //  将支付方式变为“”;
        map.put("payWay", "");
        //  校验签名;
        SignHelper.checkSign(map);
        //  2.  防止重复提交订单;
        //  2.1 获取到页面流水号;
        String tradeNo = orderInfoVo.getTradeNo();
        //  2.2 与缓存流水号进行比较;
        String tradeNoKey = "tradeNo:" + userId + ":" + tradeNo;
        //  2.3 比较; 或 判断key是否存在;
        //  定义lua脚本;
        String screptText = "if redis.call(\"get\",KEYS[1]) == ARGV[1]\n" +
                "then\n" +
                "    return redis.call(\"del\",KEYS[1])\n" +
                "else\n" +
                "    return 0\n" +
                "end";
        //  当键值与口令串一致的时候就删除数据;
        //  创建RedisScript对象;
        DefaultRedisScript<Long> script = new DefaultRedisScript<>();
        script.setResultType(Long.class);
        script.setScriptText(screptText);
        Long count = (Long) this.redisTemplate.execute(script, Arrays.asList(tradeNoKey), tradeNo);
        if (count == 0) {
            //  删除失败; 页面的值与缓存的值不相等; 重复提交了;
            throw new RuntimeException("重复提交订单");
        }
        //  声明一个订单号;
        String orderNo = UUID.randomUUID().toString().replaceAll("-", "");
        //  3.  判断支付方式;
        if (!SystemConstant.ORDER_PAY_ACCOUNT.equals(orderInfoVo.getPayWay())) {
            //  在线支付;
            this.saveOrder(userId, orderNo, orderInfoVo);
            //  发送延迟消息；实现取消订单功能; 本质就是更新订单表中的状态; order_status
            rabbitService.sendDealyMessage(MqConst.EXCHANGE_CANCEL_ORDER, MqConst.ROUTING_CANCEL_ORDER, orderNo, MqConst.CANCEL_ORDER_DELAY_TIME);
        } else {
            //  余额支付;
            this.saveOrder(userId, orderNo, orderInfoVo);
            //  扣减余额;  选择远程调用：如何保证结果错误时；业务数据回滚? seata 分布式事务解决；
            AccountDeductVo accountDeductVo = new AccountDeductVo();
            accountDeductVo.setOrderNo(orderNo);
            accountDeductVo.setUserId(userId);
            accountDeductVo.setAmount(orderInfoVo.getOrderAmount());
            accountDeductVo.setContent(orderInfoVo.getOrderDetailVoList().get(0).getItemName());
            //  实现远程调用;
            Result result = userAccountFeignClient.checkAndDeduct(accountDeductVo);
            //  记录当前用户购买信息;
            if (200 != result.getCode()) {
                throw new RuntimeException("扣减余额失败");
            }
            //  扣减成功; 更新订单状态;
            OrderInfo orderInfo = new OrderInfo();
            orderInfo.setOrderStatus(SystemConstant.ORDER_STATUS_PAID);
            orderInfo.setUpdateTime(new Date());
            //  修改订单状态;
            orderInfoMapper.update(orderInfo, new LambdaQueryWrapper<OrderInfo>().eq(OrderInfo::getOrderNo, orderNo));
            //  保存用户购买记录 必然跟用微服务;
            //  构建实体类：
            UserPaidRecordVo userPaidRecordVo = new UserPaidRecordVo();
            userPaidRecordVo.setOrderNo(orderNo);
            userPaidRecordVo.setUserId(userId);
            //  用它来判断用户具体购买的内容：
            userPaidRecordVo.setItemType(orderInfoVo.getItemType());
            //  itemIdList 购买类型Id; 从哪里来? 页面传递的 声音Id, 专辑Id ，vipId;都在 orderDetailVoList 这个集合中！
            //  如果购买专辑,vip的话；这个集合中 orderDetailVoList 只有一条记录; 购买声音的话，这个集合中orderDetailVoList 有多条记录;
            List<Long> itemIdList = orderInfoVo.getOrderDetailVoList().stream().map(OrderDetailVo::getItemId).collect(Collectors.toList());
            userPaidRecordVo.setItemIdList(itemIdList);
            //  远程调用：
            Result userResult = userInfoFeignClient.savePaidRecord(userPaidRecordVo);
            //  判断用户购买记录保存成功;
            if (200 != userResult.getCode()) {
                //  出现异常
                throw new RuntimeException("保存用户购买记录失败");
            }
        }
        //  返回数据;
        return orderNo;
    }

    /**
     * 保存订单信息;
     *
     * @param userId
     * @param orderNo
     * @param orderInfoVo
     */
    @Transactional(rollbackFor = Exception.class)
    public void saveOrder(Long userId, String orderNo, OrderInfoVo orderInfoVo) {
        //  order_info order_detail order_derate;
        OrderInfo orderInfo = new OrderInfo();
        //  属性拷贝;
        BeanUtils.copyProperties(orderInfoVo, orderInfo);
        //  赋值用户Id
        orderInfo.setUserId(userId);
        //  订单标题;
        orderInfo.setOrderTitle(orderInfoVo.getOrderDetailVoList().get(0).getItemName());
        //  订单编号
        orderInfo.setOrderNo(orderNo);
        //  保存订单;
        orderInfoMapper.insert(orderInfo);
        //  保存订单明细;
        //  获取订单明细;
        List<OrderDetailVo> orderDetailVoList = orderInfoVo.getOrderDetailVoList();
        //  只有购买声音的时候，这个集合才有可能是多条数据； 购买vip 专辑只有一条数据;
        //  订单明细表中的itemId 是谁? 专辑Id, 声音Id, vipId;
        if (!CollectionUtils.isEmpty(orderDetailVoList)) {
            //  循环遍历;
            for (OrderDetailVo orderDetailVo : orderDetailVoList) {
                //  创建对象
                OrderDetail orderDetail = new OrderDetail();
                //  属性拷贝：
                BeanUtils.copyProperties(orderDetailVo, orderDetail);
                orderDetail.setOrderId(orderInfo.getId());
                //  保存数据;
                orderDetailMapper.insert(orderDetail);
            }
        }
        //  减免;
        List<OrderDerateVo> orderDerateVoList = orderInfoVo.getOrderDerateVoList();
        if (!CollectionUtils.isEmpty(orderDerateVoList)) {
            //  循环遍历
            for (OrderDerateVo orderDerateVo : orderDerateVoList) {
                //  创建减免对象;
                OrderDerate orderDerate = new OrderDerate();
                //  属性拷贝;
                BeanUtils.copyProperties(orderDerateVo, orderDerate);
                orderDerate.setOrderId(orderInfo.getId());
                orderDerateMapper.insert(orderDerate);
            }
        }
    }

    @Override
    public OrderInfoVo trade(TradeVo tradeVo, Long userId) {
        //  本质就是给OrderInfoVo 属性赋值;
        //  原始金额
        BigDecimal originalAmount = new BigDecimal("0.00");
        //  减免金额
        BigDecimal derateAmount = new BigDecimal("0.00");
        //  实际金额
        BigDecimal orderAmount = new BigDecimal("0.00");
        //  订单明细
        List<OrderDetailVo> orderDetailVoList = new ArrayList<>();
        //  减免明细
        List<OrderDerateVo> orderDerateVoList = new ArrayList<>();

        //  通过判断来区分购买的项目;
        if (SystemConstant.ORDER_ITEM_TYPE_ALBUM.equals(tradeVo.getItemType())) {
            //  专辑;
            Long albumId = tradeVo.getItemId();
            //  远程调用判断用户是否购买过专辑;
            Result<Boolean> result = userInfoFeignClient.isPaidAlbum(albumId);
            Assert.notNull(result, "远程调用判断用户是否购买过专辑失败");
            if (result.getData()) {
                //  抛出异常
                throw new RuntimeException("用户购买过专辑");
            }
            //  远程调用;
            Result<AlbumInfo> infoResult = albumInfoFeignClient.getAlbumInfo(albumId);
            Assert.notNull(infoResult, "远程调用获取专辑信息失败");
            AlbumInfo albumInfo = infoResult.getData();
            Assert.notNull(albumInfo, "远程调用获取专辑信息失败");
            //  赋值原始金额;
            originalAmount = albumInfo.getPrice();
            //  折扣针对专辑;albumInfo 获取用户的身份; userInfoFeignClient
            Result<UserInfoVo> infoVoResult = userInfoFeignClient.getUserInfo(userId);
            Assert.notNull(infoVoResult, "远程调用获取用户信息失败");
            UserInfoVo userInfoVo = infoVoResult.getData();
            Assert.notNull(userInfoVo, "远程调用获取用户信息失败");
            //  判断用户是否为VIP;
            if (0 == userInfoVo.getIsVip() || (1 == userInfoVo.getIsVip() && userInfoVo.getVipExpireTime().before(new Date()))) {
                //  普通用户；
                if (albumInfo.getDiscount().compareTo(new BigDecimal("-1")) != 0) {
                    //  说明有折扣; 1000 8折; 折扣价200; 1000-800=200; 1000*(10-8)=2000/10;
                    derateAmount = originalAmount.multiply(new BigDecimal("10").subtract(albumInfo.getDiscount())).divide(new BigDecimal("10"), 2, BigDecimal.ROUND_HALF_UP);
                }
            } else {
                // vip 用户；
                if (albumInfo.getVipDiscount().compareTo(new BigDecimal("-1")) != 0) {
                    //  说明有折扣; 1000 8折; 折扣价200; 1000-800=200; 1000*(10-8)=2000/10;
                    derateAmount = originalAmount.multiply(new BigDecimal("10").subtract(albumInfo.getVipDiscount())).divide(new BigDecimal("10"), 2, BigDecimal.ROUND_HALF_UP);
                }
            }
            //  实际金额
            orderAmount = originalAmount.subtract(derateAmount);
            //  订单明细;
            OrderDetailVo orderDetailVo = new OrderDetailVo();
            //  赋值：
            orderDetailVo.setItemId(tradeVo.getItemId());
            orderDetailVo.setItemName(albumInfo.getAlbumTitle());
            orderDetailVo.setItemPrice(orderAmount);
            orderDetailVo.setItemUrl(albumInfo.getCoverUrl());
            orderDetailVoList.add(orderDetailVo);
            //  减免明细;
            OrderDerateVo orderDerateVo = new OrderDerateVo();
            if (derateAmount.compareTo(new BigDecimal("0")) != 0) {
                //  折扣金额大于0;
                orderDerateVo.setDerateAmount(derateAmount);
                orderDerateVo.setDerateType(SystemConstant.ORDER_DERATE_ALBUM_DISCOUNT);
                orderDerateVo.setRemarks("专辑折扣");
                orderDerateVoList.add(orderDerateVo);
            }
        } else if (SystemConstant.ORDER_ITEM_TYPE_TRACK.equals(tradeVo.getItemType())) {
            //  声音; track.id=itemId; 声音Id; trackCount=购买的集数; 10
            /*
            {"itemType":"1002","itemId":18064,"trackCount":16}
             */
            //  trackCount 可以是0集 - 购买本集? 绝对不能小于0!
            if (tradeVo.getTrackCount() < 0) {
                throw new RuntimeException("购买集数不能小于0");
            }
            //  购买声音不支持折扣! 正常购买! 给原始金额，减免金额X，实际金额，订单明细，减免明细赋值X;
            //  原始金额=实际金额=单价(albumInfo.getPrice())*数量(trackCount);
            //  订单明细=每一集声音Id的明细（价格，标题，图片等信息）
            //  通过声音Id获取声音对象，通过声音对象获取专辑Id;
            //  Result<TrackInfo> trackInfoResult = trackInfoFeignClient.getTrackInfo(tradeVo.getItemId());
            //  Assert.notNull(trackInfoResult, "远程调用获取声音对象失败");
            //  TrackInfo trackInfo = trackInfoResult.getData();
            //  Assert.notNull(trackInfo, "远程调用获取声音对象失败");
            //  Long albumId = trackInfo.getAlbumId();
            Result<List<TrackInfo>> trackInfoListResult = trackInfoFeignClient.findPaidTrackInfoList(tradeVo.getItemId(), tradeVo.getTrackCount());
            Assert.notNull(trackInfoListResult, "远程调用获取声音对象失败");
            List<TrackInfo> trackInfoList = trackInfoListResult.getData();
            Assert.notNull(trackInfoList, "远程调用获取声音对象失败");
            //  获取专辑对象;
            Result<AlbumInfo> infoResult = albumInfoFeignClient.getAlbumInfo(trackInfoList.get(0).getAlbumId());
            Assert.notNull(infoResult, "远程调用获取专辑对象失败");
            AlbumInfo albumInfo = infoResult.getData();
            Assert.notNull(albumInfo, "远程调用获取专辑对象失败");
            //  原始金额=实际金额=单价(albumInfo.getPrice())*数量(trackCount);
            originalAmount = tradeVo.getTrackCount() == 0 ? albumInfo.getPrice() : albumInfo.getPrice().multiply(new BigDecimal(tradeVo.getTrackCount()));
            //  订单实际金额;
            orderAmount = originalAmount;

            //  循环遍历获取这个集合数据并给orderDetailVo 赋值，最后组成一个新的集合;
            orderDetailVoList = trackInfoList.stream().map(trackInfo1 -> {
                //  订单明细=每一集声音Id的明细（价格，标题，图片等信息）
                OrderDetailVo orderDetailVo = new OrderDetailVo();
                //  赋值; 购买集数有关系! 从; 18064 往后数 16 集;
                orderDetailVo.setItemId(trackInfo1.getId());
                orderDetailVo.setItemName(trackInfo1.getTrackTitle());
                orderDetailVo.setItemPrice(albumInfo.getPrice());
                orderDetailVo.setItemUrl(trackInfo1.getCoverUrl());
                //  返回数据
                return orderDetailVo;
            }).collect(Collectors.toList());
            //  toList()会排除空数据; Collectors.toList()

        } else {
            //  vip; itemId=vip_service_config.id;
            Long itemId = tradeVo.getItemId();
            //  获取vip_service_config对应大数据;
            Result<VipServiceConfig> serviceConfigResult = vipServiceConfigFeignClient.getVipServiceConfig(itemId);
            Assert.notNull(serviceConfigResult, "远程调用获取vip_service_config对应大数据失败");
            VipServiceConfig vipServiceConfig = serviceConfigResult.getData();
            Assert.notNull(vipServiceConfig, "远程调用获取vip_service_config对应大数据失败");
            //  原始金额
            originalAmount = vipServiceConfig.getPrice();
            //  折扣金额
            derateAmount = originalAmount.subtract(vipServiceConfig.getDiscountPrice());
            //  实际金额;
            orderAmount = vipServiceConfig.getDiscountPrice();
            //  订单明细;
            OrderDetailVo orderDetailVo = new OrderDetailVo();
            orderDetailVo.setItemId(itemId);
            orderDetailVo.setItemName(vipServiceConfig.getName());
            orderDetailVo.setItemPrice(orderAmount);
            orderDetailVo.setItemUrl(vipServiceConfig.getImageUrl());
            orderDetailVoList.add(orderDetailVo);
            //  订单减免;
            if (derateAmount.compareTo(new BigDecimal("0")) != 0) {
                OrderDerateVo orderDerateVo = new OrderDerateVo();
                //  折扣金额大于0;
                orderDerateVo.setDerateAmount(derateAmount);
                orderDerateVo.setDerateType(SystemConstant.ORDER_DERATE_VIP_SERVICE_DISCOUNT);
                orderDerateVo.setRemarks("vip折扣");
                orderDerateVoList.add(orderDerateVo);
            }
        }
        //  创建一个对象
        OrderInfoVo orderInfoVo = new OrderInfoVo();
        //  交易号不能为空
        String tradeNo = UUID.randomUUID().toString().replaceAll("-", "");
        //  需要存储一个tradeNo;
        String tradeNoKey = "tradeNo:" + userId + ":" + tradeNo;
        this.redisTemplate.opsForValue().setIfAbsent(tradeNoKey, tradeNo, 15, TimeUnit.MINUTES);
        orderInfoVo.setTradeNo(tradeNo);
        //  支付方式默认为空;
        orderInfoVo.setPayWay("");
        orderInfoVo.setItemType(tradeVo.getItemType());
        orderInfoVo.setOriginalAmount(originalAmount);
        orderInfoVo.setDerateAmount(derateAmount);
        orderInfoVo.setOrderAmount(orderAmount);
        orderInfoVo.setOrderDetailVoList(orderDetailVoList);
        orderInfoVo.setOrderDerateVoList(orderDerateVoList);
        //  时间戳 自定义;
        long timestamp = SignHelper.getTimestamp();
        orderInfoVo.setTimestamp(timestamp);
        //  自定义签名；保证接口不被篡改,保证接口安全性
        //  创建一个 map; map 与 实体类本质是一回事!
        String jsonStr = JSON.toJSONString(orderInfoVo);
        //  通过| 拼接实体类的属性值; 并追加一个盐(固定字符串),再采用md5 加密得到的字符串
        String sign = SignHelper.getSign(JSON.parseObject(jsonStr, Map.class));
        orderInfoVo.setSign(sign);
        //  返回对象
        return orderInfoVo;
    }
}
